// src/factories/TranslatorFactory.ts
import { type Translator } from './Translator';
import {  StarDictTranslator } from './StarDictTranslator';
import { XxApiTranslator } from './XxApiTranslator';
import { YoudaoTranslator } from './YoudaoTranslator';

export class TranslatorFactory {
  private translators: Map<string, Translator>;

  constructor() {
    this.translators = new Map();
    this.translators.set('stardict(暂不可用)', new StarDictTranslator());
    this.translators.set('xxApi', new XxApiTranslator());
    this.translators.set('有道字典', new YoudaoTranslator());

  }

  getTranslator(id: string): Translator | undefined {
    return this.translators.get(id);
  }

  getAllTranslators(): Map<string, Translator> {
    return this.translators;
  }
}